<?php
 /*****************************************************************************
 * confirmDeleteInvoice.php                                                   *
 * Last Modified: 2007-06-06                                                  *
 *                                                                            *
 * confirmDeleteInvoice.php is used to present a dialog box requesting the    *
 * user to confirm or deny the deletion of the selected invoice record.       *
 *                                                                            *
 * BBG_Billing, a PHP application using MySQL for creating and maintaining a  *
 * contacts and invoices database.                                            *
 *                                                                            *
 * @copyright Copyright (C) 2007, Bugs Bee Gone Computer Services             *
 * @owner     Daniel Barnett (Bugs Bee Gone Computer Services)                *
 * @author    Daniel Barnett <dbarnett@bugsbeegone.com>                       *
 * @website   http://www.bugsbeegone.com                                      *
 * @license   http://www.gnu.org/licenses/gpl.html GNU General Public License *
 * @package   BBG_Billing                                                     *
 * @name      confirmDeleteInvoice.php                                        *
 * @version   1.0.0                                                           *
 * @uses      Jpmaster77's Login Script (Written by: Jpmaster77, 2004-08-19)  *
 *             ->(http://www.evolt.org/PHP-Login-System-with-Admin-Features/) *
 *                                                                            *
 * This file is part of the "BBG_Billing" PHP application.                    *
 *                                                                            *
 * BBG_Billing is free software; you can redistribute it and/or modify        *
 * it under the terms of the GNU General Public License as published by       *
 * the Free Software Foundation; either version 2 of the License, or          *
 * (at your option) any later version.                                        *
 *                                                                            *
 * BBG_Billing is distributed in the hope that it will be useful,             *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
 * GNU General Public License for more details.                               *
 *                                                                            *
 * You should have received a copy of the GNU General Public License          *
 * along with BBG_Billing; if not, write to the Free Software                 *
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA *
 *****************************************************************************/

  // Require session.php for user access control
	require "include/session.php";

  // If user is not logged in, redirect to main.php
	if(!$session->logged_in){
		header("Location: main.php");
		exit();
  //If user is logged in...
	} else {
    // Get invoiceNum value from URL
		$invoiceNum = $_GET['invoiceNum'];

    // If invoiceNum is not NULL...
		if($invoiceNum != "") {
			echo '<html>' . "\n";
			echo '<head>' . "\n";
			echo '<script type="text/javascript">' . "\n";
			echo '<!--' . "\n";
			echo 'var answer = confirm ("Do you want to delete this invoice?")' . "\n";
			echo 'if (answer)' . "\n";
			echo 'window.location="deleteInvoice.php?invoiceNum=' . $invoiceNum . '"' . "\n";
			echo 'else' . "\n";
			echo 'window.location="invoices.php"' . "\n";
			echo '// -->' . "\n";
			echo '</script>' . "\n";
			echo '</head>' . "\n";
			echo '</html>' . "\n";
    // If invoiceNum is NULL, die with error message and redirect to invoices.php after 2 seconds
		} else {
			die('<html><head><meta http-equiv="refresh" content="2;url=invoices.php"></head><body>Error: No Record Key Provided.</body></html>');
		} // End If($invoiceNum!="")
	} // End If(!$session->logged_in)
?>
